window.onload = function () {
    modifyOperatePanel();
}

//modifyOperatePanel 修改操做中心相关信息
function modifyOperatePanel() {
    //获取职位
    let userRank = $(".operatePanel").data("user_rank")
    //修改操作面板
    //代销处负责人
    console.log(userRank)
    if (userRank === "principal") {
        let loginUserInfo = $(".loginUserInfo").text() + "代销处负责人";
        $(".loginUserInfo").text(loginUserInfo);
    } else if (userRank === "saleSupervisor") {
        let loginUserInfo = $(".loginUserInfo").text() + "销售主管";
        $(".loginUserInfo").text(loginUserInfo);
    } else if (userRank === "deliverySupervisor") {
        let loginUserInfo = $(".loginUserInfo").text() + "送货主管";
        $(".loginUserInfo").text(loginUserInfo);
    }else if (userRank === "finance") {
        let loginUserInfo = $(".loginUserInfo").text() + "财务主管";
        $(".loginUserInfo").text(loginUserInfo);
    }else if (userRank === "marketingSupervisor") {
        let loginUserInfo = $(".loginUserInfo").text() + "营销主管";
        $(".loginUserInfo").text(loginUserInfo);
    }
    addOperatePanel(userRank);
}

//addPanel 添加操作面板相关按钮
function addOperatePanel(userRank) {
    let operatePanel = document.getElementsByClassName("operatePanel")
    if (userRank === "principal") {
        operatePanel[0].innerHTML = '' +
            '<a href="/operateCenter/queryIndent">查询订单</a><br>' +
            '<a href="/operateCenter/Indent">订货</a>'
    } else if (userRank === "saleSupervisor") {
        operatePanel[0].innerHTML = '' +
            '<a href="/operateCenter/queryIndent">查询订单</a><br>'
    } else if (userRank === "deliverySupervisor") {
        operatePanel[0].innerHTML = '' +
            '<a href="/operateCenter/deliveryInventory">生成当日送货清单</a><br>'
    }else if (userRank === "finance") {
        operatePanel[0].innerHTML = '' +
            '<a href="/operateCenter/financeInventory">生成财务清单</a><br>'
    }else if(userRank==="marketingSupervisor"){
        operatePanel[0].innerHTML = '' +
            '<a href="/operateCenter/nowMonthUser">生成当月用户信息表</a><br>'
    }
}